package com.sky.controller.admin;

import com.sky.result.Result;
import com.sky.utils.AliOSSUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @author yangeit
 * @date 2023年11月18日 10:57
 * @Description 凡是公共的接口，都放在这里
 */
@RestController
@Slf4j
@RequestMapping("/admin/common")
@Api(tags = "通用接口")
public class CommonController {
    @Autowired
    AliOSSUtils aliOSSUtils;


    @PostMapping("/upload")
    @ApiOperation("上传图片")
    public Result upload(MultipartFile file) throws IOException {

        log.info("upload:{}",file.getOriginalFilename());

         String upload = aliOSSUtils.upload(file);


        return Result.success(upload);

    }







}
